home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CRON_1 / STANDARD / STRINGUT.H < prev    next >
Text File  |  1991-08-11  |  4KB  |  150 lines

  1. #ifndef _StringUtil_
  2. #define _StringUtil_
  3.  
  4.  
  5. #ifndef NULL
  6. #define NULL            0L
  7. #endif
  8.  
  9.  
  10. /*    WARNING:  NumberAppend and NumberAppendLimit both use the NumToString
  11.     procedure to convert the supplied number into a string.  As a result,
  12.     they may both MOVE OR PURGE MEMORY.
  13. */
  14.  
  15.  
  16. void                    StringAppend(StringPtr SrcStr, StringPtr DestStr);
  17. void                    StringAppends(StringPtr DestStr, int StringCount, StringPtr FirstString, ...);
  18. void                    StringAppendLimit(StringPtr SrcStr, StringPtr DestStr, int LengthLimit);
  19.  
  20. void                    StringInsert(StringPtr SrcStr, StringPtr DestStr, int DestOffset);
  21.  
  22. void                    NumberAppend(long SrcNum, StringPtr DestStr);
  23. void                    NumberAppendLimit(long SrcNum, StringPtr DestStr, int LengthLimit);
  24.  
  25.  
  26. /*    ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  27.     String Utilities -- Procedure Summary
  28.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  29.     
  30.     
  31.     String Utilities is a set of routines that perform some basic, and
  32.     generally handy, operations on Pascal strings in a pleasantly 
  33.     efficient manner.
  34.     
  35.     
  36.     Appending Strings
  37.     Ñ    StringAppend
  38.     Ñ    StringAppends
  39.     Ñ    StringAppendLimit
  40.     
  41.     Inserting Strings
  42.     Ñ    StringInsert
  43.     
  44.     Appending Numbers to Strings
  45.     Ñ    NumberAppend
  46.     Ñ    NumberAppendLimit
  47.     
  48.     
  49.     
  50.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  51.     Appending Strings
  52.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  53.     
  54.     
  55.     StringAppend
  56.     ╤╤╤╤╤╤╤╤╤╤╤╤
  57.     
  58.     void StringAppend(StringPtr SrcStr, StringPtr DestStr);
  59.     
  60.     StringAppend appends SrcStr to DestStr, omitting any portions of 
  61.     SrcStr that will not fit in DestStr.
  62.     
  63.     
  64.     StringAppends
  65.     ╤╤╤╤╤╤╤╤╤╤╤╤╤
  66.  
  67.     void StringAppends(StringPtr DestStr, int StringCount, 
  68.         StringPtr FirstString, ...);
  69.         
  70.     StringAppends appends multiple strings to DestStr.  StringCount is
  71.     the number of strings to be appended, while FirstString and all 
  72.     subsequent parameters should be pointers to the strings to be 
  73.     appended.  Any of those StringPtrs which is NULL will be replaced 
  74.     by a tab character.
  75.     
  76.     
  77.     StringAppendLimit
  78.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  79.     
  80.     void StringAppendLimit(StringPtr SrcStr, StringPtr DestStr, 
  81.         int LengthLimit);
  82.     
  83.     Unlike both StringAppend and StringAppends, StringAppendLimit does
  84.     not assume that DestStr is a Str255.  StringAppendLimit allows you
  85.     to specify the maximum permissible length of DestStr.  Other than
  86.     that, it operates identically to StringAppend; in fact, StringAppend
  87.     is nothing more than a call to StringAppendLimit in which the limit
  88.     parameter is 255.
  89.     
  90.     
  91.     
  92.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  93.     Inserting Strings
  94.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  95.     
  96.     
  97.     StringInsert
  98.     ╤╤╤╤╤╤╤╤╤╤╤╤
  99.     
  100.     void StringInsert(StringPtr SrcStr, StringPtr DestStr, 
  101.         int DestOffset);
  102.     
  103.     StringInsert inserts SrcStr into DestStr at the character position
  104.     specified by DestOffset.  Calling StringInsert with DestOffset set
  105.     to zero, for instance, inserts SrcStr at the beginning of DestStr.
  106.     
  107.     
  108.     
  109.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  110.     Appending Numbers to Strings
  111.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  112.     
  113.     
  114.     NumberAppend
  115.     ╤╤╤╤╤╤╤╤╤╤╤╤    
  116.     
  117.     void NumberAppend(long SrcNum, StringPtr DestStr);
  118.     
  119.     NumberAppend converts the number in SrcNum to a string by calling
  120.     NumToString and then appends that string to DestStr using the
  121.     StringAppend procedure.
  122.     
  123.     
  124.     NumberAppendLimit
  125.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  126.     
  127.     void NumberAppendLimit(long SrcNum, StringPtr DestStr, 
  128.         int LengthLimit);
  129.     
  130.     NumberAppendLimit works just like NumberAppend, but allows you to
  131.     specify the maximum length of DestStr in the LengthLimit parameter.
  132.     
  133.     
  134.     WARNING:  NumberAppend and NumberAppendLimit both call NumToString
  135.               which can cause memory to be moved or purged.
  136.     
  137.     
  138.     
  139.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  140.     Internet:    chrisj@emx.utexas.edu
  141.     UUCP:        {husc6|uunet}!cs.utexas.edu!ut-emx!chrisj
  142.     BitNet:        chrisj@utxvm.bitnet
  143.     AppleLink:    chrisj@emx.utexas.edu@internet#
  144.     CompuServe:    >INTERNET:chrisj@emx.utexas.edu
  145.     US Mail:    Chris Johnson, 3311 Red River #305, Austin, TX 78705
  146.     ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  147. */
  148.  
  149.  
  150. #endif